package custom

import (
	"fyne.io/fyne/v2/widget"
)

func NewEditingSlider(min, max float64, dragEndFunc func(float64)) *EditingSlider {
	e := &EditingSlider{
		Slider: &widget.Slider{
			Min: min,
			Max: max,
		},
		dragEndFunc: dragEndFunc,
	}
	e.ExtendBaseWidget(e)
	return e
}

type EditingSlider struct {
	*widget.Slider
	dragEndFunc func(float64)
}

func (e *EditingSlider) DragEnd() {
	if e.dragEndFunc == nil {
		return
	}
	e.dragEndFunc(e.Value)
}
func (e *EditingSlider) SetDragEndFunc(f func(float64)) {
	e.dragEndFunc = f
}
